import http from './request'

const menu = {
  // 根据用户获取导航菜单 - 路由表
  treeByUser(id) {
    return http.get(`/sysPermission/treeByUser?userId=${id}`)
  },

  // 获取菜单管理所有菜单 - 菜单列表
  tree() {
    return http.get(`/sysPermission/tree`)
  },

  // 修改菜单
  insert(data = {}) {
    return http.post(`/sysPermission/insert`, data)
  },

  // 修改菜单
  update(data = {}) {
    return http.put(`/sysPermission/update`, data)
  },
  // 通过角色id 获取 角色对应菜单
  treeByRoleId(id) {
    return http.get(`/sysPermission/tree/${id}`)
  },

  // 删除菜单项
  deleteById(id) {
    return http.delete(`/sysPermission/deleteById?id=${id}`)
  },

  // 获取菜单下的按钮权限
  listMenuJurisdiction(id) {
    return http.get(`/sysPermission/listMenuJurisdiction?menuId=${id}`)
  }
}

export default menu
